package com.eastfair.certificate.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.certificate.enumeration.FormFieldSubsystemMethodTypeEnum;
import com.eastfair.certificate.enumeration.FormFieldSubsystemFieldTypeAttributeEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 动态表单
 * </p>
 *
 * @author ligang
 * @since 2023-05-17
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("c_form_field_subsystem")
@ApiModel(value = "FormFieldSubsystem", description = "动态表单")
@AllArgsConstructor
public class FormFieldSubsystem extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 语言环境
     */
    @ApiModelProperty(value = "语言环境")
    @Size(max = 16, message = "语言环境长度不能超过16")
    @TableField(value = "language_type", condition = LIKE)
    @Excel(name = "语言环境")
    private String languageType;

    /**
     * 字段名称
     */
    @ApiModelProperty(value = "字段名称")
    @Size(max = 256, message = "字段名称长度不能超过256")
    @TableField(value = "field_name", condition = LIKE)
    @Excel(name = "字段名称")
    private String fieldName;

    /**
     * 字段英文名称
     */
    @ApiModelProperty(value = "字段英文名称")
    @Size(max = 256, message = "字段英文名称长度不能超过256")
    @TableField(value = "field_en_name", condition = LIKE)
    @Excel(name = "字段英文名称")
    private String fieldEnName;

    /**
     * 关键字
     */
    @ApiModelProperty(value = "关键字")
    @Size(max = 256, message = "关键字长度不能超过256")
    @TableField(value = "keyword", condition = LIKE)
    @Excel(name = "关键字")
    private String keyword;

    /**
     * 字段类型 单选，多选，下拉，输入
     */
    @ApiModelProperty(value = "字段类型 单选，多选，下拉，输入")
    @Size(max = 128, message = "字段类型 单选，多选，下拉，输入长度不能超过128")
    @TableField(value = "field_type", condition = LIKE)
    @Excel(name = "字段类型 单选，多选，下拉，输入")
    private String fieldType;

    /**
     * 组id
     */
    @ApiModelProperty(value = "组id")
    @TableField(value = "group_id")
    @Excel(name = "组id")
    private Long groupId;

    /**
     * 字段类型属性:#{DICT:字典;API:api;OTHER:自定义;}
     */
    @ApiModelProperty(value = "字段类型属性:#{DICT:字典;API:api;OTHER:自定义;}")
    @TableField(value = "field_type_attribute")
    @Excel(name = "字段类型属性:#{DICT:字典;API:api;OTHER:自定义;}", replace = {"字典_DICT", "api_API", "自定义_OTHER",  "_null"})
    private FormFieldSubsystemFieldTypeAttributeEnum fieldTypeAttribute;

    /**
     * 接口地址
     */
    @ApiModelProperty(value = "接口地址")
    @Size(max = 255, message = "接口地址长度不能超过255")
    @TableField(value = "field_type_url_value", condition = LIKE)
    @Excel(name = "接口地址")
    private String fieldTypeUrlValue;

    /**
     * 接口请求方式#{GET:get;POST:post;PUT:put}
     */
    @ApiModelProperty(value = "接口请求方式#{GET:get;POST:post;PUT:put}")
    @TableField(value = "method_type")
    @Excel(name = "接口请求方式#{GET:get;POST:post;PUT:put}", replace = {"get_GET", "post_POST", "put_PUT",  "_null"})
    private FormFieldSubsystemMethodTypeEnum methodType;

    /**
     * 字段类型属性值
     */
    @ApiModelProperty(value = "字段类型属性值")
    @Size(max = 256, message = "字段类型属性值长度不能超过256")
    @TableField(value = "field_type_attribute_value", condition = LIKE)
    @Excel(name = "字段类型属性值")
    private String fieldTypeAttributeValue;

    /**
     * 提示语
     */
    @ApiModelProperty(value = "提示语")
    @Size(max = 256, message = "提示语长度不能超过256")
    @TableField(value = "placeholder", condition = LIKE)
    @Excel(name = "提示语")
    private String placeholder;

    /**
     * 英文提示语
     */
    @ApiModelProperty(value = "英文提示语")
    @Size(max = 256, message = "英文提示语长度不能超过256")
    @TableField(value = "en_placeholder", condition = LIKE)
    @Excel(name = "英文提示语")
    private String enPlaceholder;

    /**
     * 字段描述
     */
    @ApiModelProperty(value = "字段描述")
    @Size(max = 1024, message = "字段描述长度不能超过1024")
    @TableField(value = "field_desc", condition = LIKE)
    @Excel(name = "字段描述")
    private String fieldDesc;

    /**
     * 字段英文描述
     */
    @ApiModelProperty(value = "字段英文描述")
    @Size(max = 1024, message = "字段英文描述长度不能超过1024")
    @TableField(value = "field_en_desc", condition = LIKE)
    @Excel(name = "字段英文描述")
    private String fieldEnDesc;

    /**
     * 字数限制
     */
    @ApiModelProperty(value = "字数限制")
    @TableField(value = "input_length")
    @Excel(name = "字数限制")
    private Integer inputLength;

    /**
     * 宽度
     */
    @ApiModelProperty(value = "宽度")
    @TableField(value = "input_width")
    @Excel(name = "宽度")
    private Integer inputWidth;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField(value = "sequence")
    @Excel(name = "排序")
    private Integer sequence;

    /**
     * 示例图片
     */
    @ApiModelProperty(value = "示例图片")
    @Size(max = 256, message = "示例图片长度不能超过256")
    @TableField(value = "legend", condition = LIKE)
    @Excel(name = "示例图片")
    private String legend;

    /**
     * 示例图片描述
     */
    @ApiModelProperty(value = "示例图片描述")
    @Size(max = 256, message = "示例图片描述长度不能超过256")
    @TableField(value = "legend_desc", condition = LIKE)
    @Excel(name = "示例图片描述")
    private String legendDesc;

    /**
     * 示例图片英文描述
     */
    @ApiModelProperty(value = "示例图片英文描述")
    @Size(max = 256, message = "示例图片英文描述长度不能超过256")
    @TableField(value = "legend_en_desc", condition = LIKE)
    @Excel(name = "示例图片英文描述")
    private String legendEnDesc;

    /**
     * 是否可编辑：1是；0否
     */
    @ApiModelProperty(value = "是否可编辑：1是；0否")
    @TableField(value = "is_edit")
    @Excel(name = "是否可编辑：1是；0否")
    private Integer isEdit;

    /**
     * 是否必填：1是；0否
     */
    @ApiModelProperty(value = "是否必填：1是；0否")
    @TableField(value = "is_required")
    @Excel(name = "是否必填：1是；0否")
    private Integer isRequired;

    /**
     * 是否多选：1是；0否
     */
    @ApiModelProperty(value = "是否多选：1是；0否")
    @TableField(value = "is_multiple")
    @Excel(name = "是否多选：1是；0否")
    private Integer isMultiple;

    /**
     * 是否需要验证：1是；0否
     */
    @ApiModelProperty(value = "是否需要验证：1是；0否")
    @TableField(value = "is_verification")
    @Excel(name = "是否需要验证：1是；0否")
    private Integer isVerification;

    /**
     * 验证关键字
     */
    @ApiModelProperty(value = "验证关键字")
    @Size(max = 256, message = "验证关键字长度不能超过256")
    @TableField(value = "verification_keyword", condition = LIKE)
    @Excel(name = "验证关键字")
    private String verificationKeyword;

    /**
     * 是否启用：1是；0否
     */
    @ApiModelProperty(value = "是否启用：1是；0否")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用：1是；0否")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 关联id
     */
    @ApiModelProperty(value = "关联id")
    @TableField(value = "related_id")
    @Excel(name = "关联id")
    private Long relatedId;

    /**
     * 标签键名
     */
    @ApiModelProperty(value = "标签键名")
    @Size(max = 255, message = "标签键名长度不能超过255")
    @TableField(value = "label_key", condition = LIKE)
    @Excel(name = "标签键名")
    private String labelKey;

    /**
     * 值键名
     */
    @ApiModelProperty(value = "值键名")
    @Size(max = 255, message = "值键名长度不能超过255")
    @TableField(value = "label_value_key", condition = LIKE)
    @Excel(name = "值键名")
    private String labelValueKey;


    @Builder
    public FormFieldSubsystem(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    String languageType, String fieldName, String fieldEnName, String keyword, String fieldType, 
                    Long groupId, FormFieldSubsystemFieldTypeAttributeEnum fieldTypeAttribute, String fieldTypeUrlValue, FormFieldSubsystemMethodTypeEnum methodType, String fieldTypeAttributeValue, String placeholder, 
                    String enPlaceholder, String fieldDesc, String fieldEnDesc, Integer inputLength, Integer inputWidth, Integer sequence, 
                    String legend, String legendDesc, String legendEnDesc, Integer isEdit, Integer isRequired, Integer isMultiple, 
                    Integer isVerification, String verificationKeyword, Integer isEnabled, Integer isDeleted, Long tenantId, Long projectId, 
                    Long subsystemId, Long relatedId, String labelKey, String labelValueKey) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.languageType = languageType;
        this.fieldName = fieldName;
        this.fieldEnName = fieldEnName;
        this.keyword = keyword;
        this.fieldType = fieldType;
        this.groupId = groupId;
        this.fieldTypeAttribute = fieldTypeAttribute;
        this.fieldTypeUrlValue = fieldTypeUrlValue;
        this.methodType = methodType;
        this.fieldTypeAttributeValue = fieldTypeAttributeValue;
        this.placeholder = placeholder;
        this.enPlaceholder = enPlaceholder;
        this.fieldDesc = fieldDesc;
        this.fieldEnDesc = fieldEnDesc;
        this.inputLength = inputLength;
        this.inputWidth = inputWidth;
        this.sequence = sequence;
        this.legend = legend;
        this.legendDesc = legendDesc;
        this.legendEnDesc = legendEnDesc;
        this.isEdit = isEdit;
        this.isRequired = isRequired;
        this.isMultiple = isMultiple;
        this.isVerification = isVerification;
        this.verificationKeyword = verificationKeyword;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.tenantId = tenantId;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.relatedId = relatedId;
        this.labelKey = labelKey;
        this.labelValueKey = labelValueKey;
    }

}
